import math
class Solution(object):
    def kthSmallestPath(self, destination, k):
        st = []
        now_count = 0
        total_count = destination[0] + destination[1]
        while total_count > 0:
            if destination[1] > 0:
                H_count = math.comb(total_count - 1, destination[1] - 1)
            else:
                st += ['V'] * total_count
                break
            if now_count + H_count >= k:
                st.append('H')
                destination[1] -= 1
            else:
                now_count += H_count
                st.append('V')
            total_count -= 1
        return ''.join(st)

data = Solution()
destination = [15,15]
k = 1
print(data.kthSmallestPath(destination, k))

